package edu.hrbu.spring.controller;

import edu.hrbu.spring.common.R;
import edu.hrbu.spring.pojo.User;
import edu.hrbu.spring.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 徐登宇
 */
@RestController
@RequestMapping("/rest")
public class UserController {

    @Resource(name = "userServiceImpl")
    UserService userService;

    @GetMapping("/user")
    public R getAllUsersPage(@RequestParam("page") int page, @RequestParam("size") int size) {
        List<User> userList = userService.getAllUsersPage(page, size);
        return R.success(userList);
    }

}
